'use strict';

const Controller = require('egg').Controller;

class DeleteController extends Controller {
    async index() {
        const { ctx } = this;
        var {id} = ctx.query;
        console.log(id)
        var data = await ctx.service.top250.deleteOne(id)
        if(data.deletedCount){   //输出为1即删除成功
            ctx.body = {
                code:200,
                msg:"删除成功"
            }
        }
        ctx.redirect("/")
    }
}
module.exports = DeleteController;
